package com.jiepos.mpos.biz.customer.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.jiepos.mpos.biz.customer.service.CustomAccountService;
import com.jiepos.mpos.common.entity.App_Custom_AccountEntity;
import com.jiepos.mpos.common.entity.App_Custom_InfEntity;
import com.jiepos.mpos.core.controller.BaseController;
import com.jiepos.mpos.core.entity.Pagination;

/**
 * 
 * 会员账户列表页及操作
 * 
 * @ProjectName: [mpos1]
 * @Package com.jiepos.mpos.biz.customer.controller
 * @author 肖志伟
 * @version 1.0
 * @since 2017年9月25日 上午11:32:40
 * @history（历次修订内容、修订人、修订时间等） @UpdateRemark [说明本次修改内容]
 * @Copyright (c) 2017 江苏杰博实信息技术有限公司
 */
@Controller
@RequestMapping("customaccount")
public class CustomAccountController extends BaseController {

	@Autowired
	private CustomAccountService customAccountService;

	/**
	 * 进入会员信息列表页界面
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/getCustomerAccountList.do")
	public ModelAndView getCustomerAccountList(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView model = new ModelAndView("/module/customer/customaccount/customaccount_list");
		return super.getDetail(request, response, model);
	}

	/**
	 * 查询会员账户json数据
	 * 
	 * @param pagination
	 *            分页实体
	 * @param appCustomAccountEntity
	 *            会员账户对象
	 * @param ins_cd
	 *            机构编码
	 * @return
	 */
	@RequestMapping("/getCustomerAccountListJson.do")
	public @ResponseBody Map getCustomerInfoListJson(HttpServletRequest request, Pagination pagination, App_Custom_InfEntity customInfEntity,
			App_Custom_AccountEntity appCustomAccountEntity, String ins_cd, String ins_name) {
		return customAccountService.getCustomerAccountList(request, pagination, customInfEntity, appCustomAccountEntity, ins_cd, ins_name);
	}

	/**
	 * 操作会员用户账户状态 启用 1/冻结 2
	 * 
	 * @param request
	 * @param response
	 * @param account_st
	 * @param account_uuids
	 * @return
	 */
	@RequestMapping("/updateCustomsAccountSt.do")
	@ResponseBody
	public void enableIns(HttpServletRequest request, HttpServletResponse response,
			App_Custom_AccountEntity appCustomAccountEntity, String account_uuids) {
		customAccountService.updateCustomAccountSt(account_uuids, super.getLoginUser(request, response), appCustomAccountEntity);
	}

}
